package com.example.demo.controller;



import com.example.demo.service.BookinfoService;
import com.example.demo.util.ResultVOUtil;
import com.example.demo.vo.BookinfoVo;
import com.example.demo.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Author: wuhen
 * Date: 2018/10/9
 * Time: 20:55
 */
@RestController
@RequestMapping("/book")
public class BookinfoController {
    @Autowired
    private BookinfoService bookinfoService;
    //查询单个
    @GetMapping("/findOne")
    public ResultVO<BookinfoVo> findbookOne(@RequestParam(value = "bookId") Integer bookId){
               BookinfoVo bookinfoVo= bookinfoService.findbookOne(bookId);
               return ResultVOUtil.success(bookinfoVo);
    }
    //查询所有
    @GetMapping("/findAll") public ResultVO<BookinfoVo> findbookAll(){
       List <BookinfoVo> bookinfoVo= bookinfoService.findbookAll();
       return ResultVOUtil.success(bookinfoVo);
   }
}
